In spreadsheet programs, such as Microsoft Excel, version 3.0, sold by Microsoft Corporation of Redmond, Wash., a user may generate and print a document. Each page of the document includes a header and a footer. The header and the footer provide places for the user to add textual information at the top and bottom of the page, respectively. The header is formed by the topmost lines of a page and holds information such as page number, title of the document, author of the document, date on which the document is printed and/or time at which the document is printed. The footer is similar to the header, but is formed by the lowermost lines of the page. The footer may include page number information and other information, like that found in the header. Both the header and the footer are separate entities from the main body of the page. The header and footer typically are not visible to the user until the document is printed.
Microsoft Excel, version 3.0, stores information about each header and each footer of the document in text strings that are stored as arrays of characters. Separate text strings are stored for the header and the footer of each page of a document. If a user does not specify information to be included in the header or the Looter, a default text string is generated by the spreadsheet program.
Each text string may include two types of information: text and/or commands. Text in the text string includes the characters that are to be printed as part of the header or footer. Commands specify formatting information, alignment information or placeholder information. The commands that specify formatting information are used to format the text that is printed as part of a header or footer. The commands that specify alignment information are used to designate where the text is to be aligned on a page of a document. Lastly, the commands that specify placeholder information are used to add placeholders in a header or footer. The placeholders may be expanded before the header or footer is printed. Thus, for example, a command may specify a page number placeholder for a header. When the header is printed, the appropriate page number is printed as part of the header.
Microsoft Excel, version 3.0, includes a parser routine that parses these text strings. The parser routine parses each text string into text and/or commands. The parser routine includes additional code for further processing the text string, such as required to print headers or footers The code for performing the additional processing is directly integrated into the parser routine.